package org.zhixiang.gisQuery.utils;

import java.math.BigDecimal;
import java.math.RoundingMode;

import lombok.Data;

/**
 * 
 * @say little Boy, don't be sad.
 * @name Rezar
 * @time 2018年9月21日 下午8:04:36
 * @Desc 些年若许,不负芳华.
 *
 */
@Data
public class AreaNodeRecord implements Comparable<AreaNodeRecord> {

	protected int originLevel;
	protected Double area;
	protected int startIndex;
	protected int height;

	protected AreaNodeRecord(int originLevel, double area, int startIndex, int height) {
		this.originLevel = originLevel;
		this.area = area;
		this.startIndex = startIndex;
		this.height = height;
	}

	@Override
	public int compareTo(AreaNodeRecord o) {
		return -this.area.compareTo(o.area);
	}

	/**
	 * @return
	 */
	public int getWidth() {
		return (new BigDecimal(this.getArea()).divide(new BigDecimal(height), 0, RoundingMode.HALF_DOWN)).intValue();
	}

}
